import json
from collections import OrderedDict

from django.shortcuts import render

# Create your views here.
from django.views import View

from apps.contents.fengzhuang import get_categories
from apps.contents.models import ContentCategory
from apps.goods.models import GoodsChannel
from apps.shoppingcart import easy_shopping


class IndexView(View):

#在返回首页的同时需要返回商品的表
    def get(self,request):

        #封装简易的购物车
        shoppingcart, amount = easy_shopping.easy_shopping(request)
        context = get_categories()
        print(context)
        # categories= get_categories()
        print(shoppingcart,amount)
        context['shoppingcart'] = shoppingcart
        context['amount']=amount


        return render(request,'index.html',context=context)

